var express = require('express');
var router = express.Router();
const dataCtrl = require('../controllers/product.controller');

/* GET users listing. */
/* router.post('/', function(req, res, next) {
    var user = new User(req.body);
    user.save().then(data => {
        //console.log(data);
        res.json(data); //以json形式进行数据返回
    })
}); */

router.post('/', dataCtrl.creat);
router.put('/:id', dataCtrl.update); //设参在路由，传参在地址，接参在控制层
router.delete('/:id', dataCtrl.remove); //设参在路由，传参在地址，接参在控制层
router.get('/:id', dataCtrl.get); //设参在路由，传参在地址，接参在控制层
router.post('/list', dataCtrl.list); //设参在路由，传参在地址，接参在控制层

module.exports = router;